<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>居中方案</title>
  </head>
  <body>
    <div class="center">
      <span>ddddddddddd</span>
    </div>
    <style>
      .center {
        text-align: center;
      }
    </style>
    <script>
      let target = {
        foo: "Welcome, foo"
      }
      let proxy = new Proxy(target, {
        get(receiver, name) {
          console.log(receiver);
          console.log(name);
          return name in receiver
            ? receiver[name]
            : `Hello, ${name}`
        }
      })
      proxy.foo === "Welcome, foo";
      proxy.world === "Hello, world";
      console.log(proxy.foo);
      console.log(proxy.world);
    </script>
  </body>
</html>
